package day10demo;


import java.sql.Time;
import java.util.Timer;
import java.util.TimerTask;

//匿名内部类的练习----定时器（定时做任务）
public class TimerDemo {
    public static void main(String[] args) {
        Timer timer = new Timer();

            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    System.out.println("3");
                    System.out.println("2");
                    System.out.println("1");
                }
            },2000L,3000L );























        /*Timer timer = new Timer();
        int interval = 1000;
        timer.schedule(
                new TimerTask(){

                    @Override
                    public void run() {
                        System.out.println("延时执行的程序");
                    }
                }
                ,5000L,1000L);*/
    }
}
